import { createRouter, createWebHashHistory } from "vue-router";
import Layout from "@/layout";

export const constantRoutes = [
  {
    path: "/login",
    component: () => import("@/views/login"),
    hidden: true,
  },
  {
    path: "/:catchAll(.*)",
    component: () => import("@/views/403"),
    hidden: true,
  },
  {
    path: "/404",
    component: () => import("@/views/404"),
    hidden: true,
  },
];
export const asyncRoutes = [
  {
    path: "/",
    component: Layout,
    redirect: "/index",
    meta: {
      title: "首页",
      icon: "home-4-line",
      affix: true,
    },
    icon: "HomeOutlined",
    children: [
      {
        path: "index",
        name: "Index",
        component: () => import("@/views/index"),
        meta: {
          title: "首页",
          icon: "home-4-line",
          affix: true,
          noKeepAlive: true,
        },
      },
    ],
  },
  {
    path: "/yq",
    component: Layout,
    redirect: "/yq/yqList",
    meta: {
      title: "yq",
      icon: "home-4-line",
    },
    icon: "HomeOutlined",
    children: [
      {
        path: "yqList",
        name: "YqList",
        component: () => import("@/views/yq"),
        meta: {
          title: "yqList",
          icon: "home-4-line",
        },
      },
    ],
  },

  // {
  //   path: "/detail",
  //   component: Layout,
  //   redirect: "/detail/detail",
  //   meta: {
  //     title: "详情",
  //     icon: "test-tube-line",
  //     tagHidden:true
  //   },
  //   hidden:true,
  //   icon: "HomeOutlined",
  //   children: [
  //     {
  //       path: "detail",
  //       name: "detail",
  //       component: () => import("@/views/anzhui"),
  //       meta: {
  //         title: "详情",
  //         icon: "test-tube-line",
  //         tagHidden:true
  //       },
  //       hidden:true,
  //     },
  //   ],
  // },
  // {
  //   path: "/error",
  //   name: "Error",
  //   component: Layout,
  //   redirect: "/error/403",
  //   meta: {
  //     title: "错误页",
  //     icon: "error-warning-line",
  //   },
  //   icon: "HomeOutlined",
  //   children: [
  //     {
  //       path: "403",
  //       name: "Error403",
  //       component: () => import("@/views/403"),
  //       meta: {
  //         title: "403",
  //         icon: "error-warning-line",
  //       },
  //     },
  //     {
  //       path: "404",
  //       name: "Error404",
  //       component: () => import("@/views/404"),
  //       meta: {
  //         title: "404",
  //         icon: "error-warning-line",
  //       },
  //     },
  //   ],
  // },
  {
    path: "/*",
    redirect: "/404",
    hidden: true,
  },
];
const router = createRouter({
  history: createWebHashHistory(),
  routes: constantRoutes,
});

export default router;
